﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Paint;
using System.Drawing;

namespace TextPluginNamespace
{
    public class TextPlugin : ITextPlugin
    {

        public Drawable getTextFigure()
        {
            using (DrawTextDialog dlg = new DrawTextDialog())
            {
                if (DialogResult.OK == dlg.ShowDialog())
                {
                    Text textFigure = new Text(new Point(), new Point());
                    textFigure.fontFamilyIndex = dlg.fontCmbx.SelectedIndex;
                    textFigure.fontSize = Int32.Parse((string)dlg.sizeCmbx.SelectedItem);
                    textFigure.text = dlg.textBox.Text;
                    return textFigure;
                }
                return null;
            }
           
        }
       
        public ToolStripItem getToolStripItem()
        {
            ToolStripButton button = new ToolStripButton("text.png");
            button.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            button.ImageTransparentColor = System.Drawing.Color.Magenta;
            button.Name = "textToolStripButton";
            button.Size = new System.Drawing.Size(23, 22);
            button.Text = "";
            return button;
        }
    }
}
